//
//  TeamDetailViewController.m
//  movement
//
//  Created by lanou on 16/5/14.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "TeamDetailViewController.h"
#import <UIImageView+WebCache.h>

@interface TeamDetailViewController ()
@property (weak, nonatomic) IBOutlet UITextView *bodyTV;
@property (weak, nonatomic) IBOutlet UILabel *nameLable;
@property (weak, nonatomic) IBOutlet UILabel *chineseName;
@property (weak, nonatomic) IBOutlet UILabel *englishName;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *mainStadium;
@property (weak, nonatomic) IBOutlet UILabel *coach;
@property (weak, nonatomic) IBOutlet UILabel *honor;
@property (weak, nonatomic) IBOutlet UILabel *honor1;
@property (weak, nonatomic) IBOutlet UITextView *cultureTV;
@property (weak, nonatomic) IBOutlet UITextView *mascot;
@property (weak, nonatomic) IBOutlet UILabel *jxw;
@property (weak, nonatomic) IBOutlet UIImageView *mascotImage;
@property (weak, nonatomic) IBOutlet UIImageView *images;

@property (nonatomic, strong) NSArray *arr;

@end

@implementation TeamDetailViewController
- (NSArray *)arr {
    if (_arr == nil) {
        _arr = [NSArray array];
    }
    return _arr;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self getData];
    [self setSubViews];
}
// 控件赋值
- (void)setSubViews {
    NSDictionary *dict = [NSDictionary dictionaryWithDictionary:self.arr[self.number]];
    if ([dict[@"honor"] isEqualToString:@"nil"]) {
        self.honor.hidden = YES;
        self.honor1.hidden = YES;
    } else {
        self.honor.text = dict[@"honor"];
    }
    if ([dict[@"mascot"] isEqualToString:@"nil"]) {
        self.mascot.hidden = YES;
        self.mascotImage.hidden = YES;
        self.jxw.hidden = YES;
    } else {
        [self.mascotImage sd_setImageWithURL:[NSURL URLWithString:dict[@"mascotImage"]]];
        self.mascot.text = dict[@"mascot"];
    }
    self.nameLable.text = dict[@"ChineseName"];
    self.bodyTV.text = dict[@"body"];
    self.images.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d.jpg", self.number + 1]];
    self.chineseName.text = dict[@"ChineseName"];
    self.englishName.text = dict[@"englishName"];
    self.mainStadium.text = dict[@"MainStadium"];
    self.coach.text = dict[@"coach"];
    self.timeLabel.text = dict[@"time"];
    self.cultureTV.text = dict[@"culture"];
    
    
}
// 数据解析
- (void)getData {
    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"NBATeam" ofType:@"plist"];
    self.arr = [NSArray arrayWithContentsOfFile:filePath];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
